6a97d9
@@ -22,6 +22,8 @@
 
 package org.jboss.as.clustering.infinispan;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
@@ -114,10 +116,24 @@
public class DefaultCacheContainer extends AbstractDelegatingEmbeddedCacheManage
 
     @Override
     public <K, V> Cache<K, V> getCache(String cacheName, String configurationName) {
-        Cache<K, V> cache = this.cm.<K, V>getCache(this.getCacheName(cacheName), this.getCacheName(configurationName));
+        Cache<K, V> cache;
+        if (System.getSecurityManager() == null) {
+            cache = this.getCacheInternal(cacheName, configurationName);
+        } else {
+            cache = AccessController.doPrivileged(new PrivilegedAction<Cache<K, V>>() {
+                @Override
+                public Cache<K, V> run() {
+                    return getCacheInternal(cacheName, configurationName);
+                }
+            });
+        }
         return (cache != null) ? new DefaultCache<>(this, this.batcherFactory, cache.getAdvancedCache()) : null;
     }
 
+    private <K, V> Cache<K, V> getCacheInternal(String cacheName, String configurationName) {
+        return cm.<K, V>getCache(this.getCacheName(cacheName), this.getCacheName(configurationName));
+    }
+
     @Override
     public <K, V> Cache<K, V> getCache(String cacheName, boolean createIfAbsent) {
         return this.getCache(cacheName, cacheName, createIfAbsent);
